#include "Boat.h"
#include "AircraftCarrier.h"
#include "Cruiser.h"
#include "Corvette.h"
#include "Submarine.h"
#include "Destroyer.h"
#include "DestroyerConfiguration.h"
#include "InvalidBoatConfiguration.h"
#include "Language.h"

Boat::Boat(const string& _name, const Point<int>& _origin) : name(_name), origin(_origin) {
}

Boat::~Boat() { }

Boat* Boat::createBoat(const string& _type, const string& _name, const Point<int>& _origin, int _configuration) throw (InvalidBoatName, InvalidBoatConfiguration) {
	if (_type == AIRCRAFTCARRIER) {
		AircraftCarrierConfiguration *config = AircraftCarrierConfiguration::createAircraftCarrierConfiguration(_configuration);
		return new AircraftCarrier(_name, _origin, config, 'a');
	}
	else if (_type == CRUISER) {
		CruiserConfiguration *config = CruiserConfiguration::createCruiserConfiguration(_configuration);
		return new Cruiser(_name, _origin, config, 'a');
	}
	else if (_type == DESTROYER) {
		DestroyerConfiguration *config = DestroyerConfiguration::createDestroyerConfiguration(_configuration);
		return new Destroyer(_name, _origin, config, 'a');
	}
	else if (_type == CORVETTE) {
		CorvetteConfiguration *config = CorvetteConfiguration::createCorvetteConfiguration(_configuration);
		return new Corvette(_name, _origin, config, 'a');
	}
	else if (_type == SUBMARINE) {
		SubmarineConfiguration *config = SubmarineConfiguration::createSubmarineConfiguration(_configuration);
		return new Submarine(_name, _origin, config, 'a');
	}
	else {
		throw InvalidBoatName();
	}
}

void Boat::setName(const string& nm) {
	name = nm;
}

string Boat::getName() const {
	return name;
}

void Boat::setOrigin(const Point<int>& pt) {
	origin = pt;
}

Point<int> Boat::getOrigin() const {
	return origin;
}


